<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .hot{
      width: 200px;
      height: 200px;
      background-color:aquamarine;
    }
  </style>
</head>
<body>
  <div class="hot">大写</div>
  <input type="text" placeholder="快写">
  <script>
    const btn=document.querySelector('div');

    btn.addEventListener('mouseenter',function(){
      console.log('鼠标进入')
    })

    btn.addEventListener('mouseleave',()=>{
      console.log('鼠标离开')
    })

    const atn=document.querySelector('input');

    atn.addEventListener('focus',()=>{
      console.log('获得焦点')
    })

    atn.addEventListener('blur',()=>{
      console.log('失去焦点')
    })

    atn.addEventListener('keydown',()=>{
      console.log("输入框 keydown 按键按下");
    })
    
    atn.addEventListener('keyup',(e)=>{
      console.log("输入框 keyup 按键抬起");
         // 判断是否按完回车键
         if (e.key == "Enter") {
          console.log("按下了回车键，可以提交表单");
        }
    })

       // 表单 value 值变化触发
       atn.addEventListener("input", (e) => {
        console.log("输入框 input 输入内容", e.currentTarget.value);
      });
  </script>
</body>
</html>